Previous Book Contents Book Index Next

Inside Macintosh: QuickDraw GX Objects /
Chapter 2 - Shape Objects


Summary of Shape Objects

Constants and Data Types

The Shape Object

typedef struct gxPrivateShapeRecord *gxShape;

Shape Type

enum gxShapeTypes {
   gxEmptyType = 1,     /* empty shape; contained by all geometries */
   gxPointType,         /* point shape */
   gxLineType,          /* line shape */ 
   gxCurveType,         /* curve shape */
   gxRectangleType,     /* rectangle shape */
   gxPolygonType,       /* polygon shape; can represent multiple polygons */
   gxPathType,          /* path shape; can include lines and curves */
   gxBitmapType,        /* bitmap shape */
   gxTextType,          /* text shape; single size, encoding, and style */
   gxGlyphType,         /* glyph shape; can use multiple text styles */
   gxLayoutType,        /* layout shape; can include linguistic info */
   gxFullType,          /* full shape; includes all geometries */
   gxPictureType        /* picture shape; can contain other shapes */
};

typedef long gxShapeType;

Shape Fill

enum gxShapeFills {
   gxNoFill,
   gxOpenFrameFill,
   gxFrameFill = gxOpenFrameFill,
   gxClosedFrameFill,
   gxHollowFill = gxClosedFrameFill,
   gxEvenOddFill,
   gxSolidFill = gxEvenOddFill,
   gxWindingFill,
   gxInverseEvenOddFill,
   gxInverseSolidFill = gxInverseEvenOddFill,
   gxInverseFill = gxInverseEvenOddFill,
   gxInverseWindingFill
};

typedef long gxShapeFill;

Shape Attributes

enum gxShapeAttributes {
   gxNoAttributes,
   gxDirectShape        = 0x0001,   /* prefer shape data to be in GX heap */
   gxRemoteShape        = 0x0002,   /* prefer shape data on accelerator */
   gxCachedShape        = 0x0004,   /* pre-calculate to optimize drawing */
   gxLockedShape        = 0x0008,   /* prevent changes to shape's geometry */
   gxGroupShape         = 0x0010,   /* treat as one shape for hit-testing */
   gxMapTransformShape  = 0x0020,   /* alter transform, not shape geometry */ 
   gxUniqueItemsShape   = 0x0040,   /* copy items added to picture shapes */
   gxIgnorePlatformShape = 0x0080,  /* assume glyph, not character, codes */
   gxNoMetricsGridShape  = 0x0100,  /* draw without font scaler's hinting */
   gxDiskShape          = 0x0200,   /* unload this shape first */
   gxMemoryShape        = 0x0400    /* unload this shape last */
};

typedef long gxShapeAttribute;

Flatten Flags

enum gxFlattenFlags{
   gxFontListFlatten       = 0x01,     /* add a tag listing fonts used */
   gxFontGlyphsFlatten     = 0x02      /* add a tag listing glyphs used */
   gxFontVariationsFlatten = 0x04,     /* add a tag for font variations */
   gxBitmapAliasFlatten    = 0x08      /* flatten all bitmap image data */
};

typedef long gxFlattenFlag;

The Spool Block Structure

struct gxSpoolBlock {
   /* these fields are read from (but not written to) by QuickDraw GX */
   gxSpoolProcPtr    spoolProcedure;   /* pointer to spool function */
   void              *buffer;          /* pointer to application buffer */
   long              bufferSize;       /* bytes for QuickDraw GX to use */
   /* these fields are written to (but not read from) by QuickDraw GX */
   long              count;            /* bytes for app to read/write */
   long              operationSize;    /* size including operand byte */
   long              operationOffset;  /* offset within current operation */
   gxGraphicsOpcode  lastTypeOpcode;   /* type of last created object */
   gxGraphicsOpcode  currentOperation; /* last op. emitted or interpreted */
   gxGraphicsOpcode  currentOperand;   /* such as gxTransformTypeOpcode */
   unsigned char     compressed;       /* a gxTwoBitCompressionValues */
};

The Hit-Test Info Structure

struct gxHitTestInfo {
   gxShapePart    what;
   long           index;
   Fixed          distance;
   gxShape        which;
   gxShape        containerPicture;
   long           containerIndex;
   long           totalIndex;
};

Spool Commands

enum gxSpoolCommands {
   gxOpenReadSpool= 1,
   gxOpenWriteSpool,
   gxReadSpool,
   gxWriteSpool,
   gxCloseSpool,
};

typedef long gxSpoolCommand;

Functions

Creating and Manipulating Shape Objects

gxShape GXGetDefaultShape	(gxShapeType aType);
void GXSetDefaultShape		(gxShape target);
gxShape GXNewShape		(gxShapeType aType);
void GXDisposeShape		(gxShape target);
long GXGetShapeSize		(gxShape source);
gxShape GXCopyToShape		(gxShape target, gxShape source);
gxShape GXCopyDeepToShape	(gxShape target, gxShape source);
boolean GXEqualShape		(gxShape one, gxShape two);
gxShape GXCloneShape		(gxShape source);
void GXCacheShape		(gxShape source);
void GXDisposeShapeCache	(gxShape target);
long GXGetShapeCacheSize	(gxShape source);

Manipulating Shape Object Properties

gxShapeType GXGetShapeType	(gxShape source);
void GXSetShapeType		(gxShape target, gxShapeType newType);
void GXSetShapeGeometry		(gxShape target, gxShape geometry);
gxShapeFill GXGetShapeFill	(gxShape source);
void GXSetShapeFill		(gxShape target, gxShapeFill newFill);
gxStyle GXGetShapeStyle		(gxShape source);
void GXSetShapeStyle		(gxShape target, gxStyle newStyle);
gxInk GXGetShapeInk		(gxShape source);
void GXSetShapeInk		(gxShape target, gxInk newInk);
gxTransform GXGetShapeTransform
				(gxShape source);
void GXSetShapeTransform	(gxShape target, gxTransform newTransform);
gxShapeAttribute GXGetShapeAttributes
				(gxShape source);
void GXSetShapeAttributes	(gxShape target, gxShapeAttribute attributes);
void GXResetShape		(gxShape target);
long GXGetShapeOwners		(gxShape source);
long GXGetShapeTags		(gxShape source, long tagType, long index,
				long count, gxTag items[]);
void GXSetShapeTags		(gxShape target, long tagType, long index,
				long oldCount, long newCount,
				const gxTag items[]);

Directly Manipulating Shape Geometry

void GXLockShape		(gxShape target);
void GXUnlockShape		(gxShape target);
void *GXGetShapeStructure	(gxShape source, long *length);
void GXChangedShape		(gxShape target);

Drawing and Hit-Testing Shapes

void GXDrawShape		(gxShape source);
gxShapePart GXHitTestShape	(gxShape target, const gxPoint *test, 
				gxHitTestInfo *result);

Flattening and Unflattening Shapes

void GXFlattenShape		(gxShape source, gxFlattenFlag flags,
				gxSpoolBlock *block);
gxShape GXUnflattenShape	(struct gxSpoolBlock *block, long count, 
				const gxViewPort portList[]);

Application-Defined Spool Function

long MySpoolProc		(gxSpoolCommand command, 
				struct gxSpoolBlock *block);


Previous Book Contents Book Index Next

© Apple Computer, Inc.
7 JUL 1996